<?php
use yii\widgets\ActiveForm;
use common\helpers\Html;

$this->title = '数据导入';
$this->params['breadcrumbs'][] = ['label' => $this->title];

?>

<div class="row">
    <div class="col-lg-12">
        <div class="box">
            <div class="box-header with-border">
                <h3 class="box-title"><?= $this->title; ?></h3>
                <div class="pull-right">
                    <?= Html::linkButton(['download', 'type' => 'employees'], '<i class="fa fa-cloud-download"></i> 下载模板'); ?>
                </div>
            </div>
            <?php $form = ActiveForm::begin([
                'options' => [
                    'enctype' => 'multipart/form-data'
                ]
            ]); ?>
            <div class="box-body">
                <div class="form-group field-provincejob-max_level">
                    <div class="hint-block" style="color:red;">
                        1.员工编号、姓名、身份证不能为空<br>
                        2.检查excel表，请不要不要导入重复数据<br>
                        3.表格内标题不要删除，采集的数据请使用文本格式<br>
                        4.政治面貌对应编号：0中共党员 1中共预备党员 1:共青团员 2:民革党员 4:民盟盟员 5:民建会员 6:民进会员 7:农工党党员 8:致公党党员 9:九三学社社员 10:台盟盟员 11:无党派人士 12:群众<br>
                        5.导入的各字段请严格按照模板提供的示例格式<br>
                    </div>
                    <div class="help-block"></div>
                </div>
                <div class="form-group">
                    <div class="input-group m-b">
                        <input id="excel-file" type="file" name="excelFile" style="display:none">
                        <input type="text" class="form-control" id="fileName" name="fileName" readonly>
                        <span class="input-group-btn">
                            <a class="btn btn-white" onclick="$('#excel-file').click();">选择文件</a>
                        </span>
                    </div>
                </div>
            </div>
            <div class="box-footer text-center">
                <button class="btn btn-primary" type="submit">保存</button>
            </div>
            <?php ActiveForm::end(); ?>
        </div>
    </div>
</div>

<script type="text/javascript">
    $('input[id=excel-file]').change(function() {
        $('#fileName').val($(this).val());
    });
</script>
